<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Set类型和数组类型之间相互转化</title>
</head>
<body>
    <script>
        let set = new Set("1234567");
        // Set类型抓化为Array类型
        // let arr = Array.from(set);
        let arr = [...set];
        console.log(arr);

        // 截取小于5的数
        let newArr = arr.filter(function (item) {
            return item < 5;
        });

        set = new Set(newArr);
        console.log(set);


        // 去除重复的元素
        let array = [1,2,3,1,3,4,5,3];
        let newSet = new Set(array);
        array = [...newSet];
        console.log(array);
    </script>
</body>
</html>